package com.xiao.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping
public class OrderController {
    private static final String paymentService = "http://cloud-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping(value = "/consumer/payment/consul")
    public String getPayment(){
        //String result = restTemplate.postForObject(paymentService + "/payment/consul", null, String.class);
        String result = restTemplate.getForObject(paymentService + "/payment/consul", String.class);

        return result;
    }
}
